package org.gp.core.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by LUOLIANG on 2016/10/11.
 */
@Controller
@RequestMapping("/index")
@Slf4j
public class TestController {

    @RequestMapping("/home")
    @ResponseBody
    public String home() {
        log.info("exec home.....");

        return "home";
    }

    @RequestMapping("/in")
    public String index(HttpServletResponse response) {
        log.info("exec home.....");
        Cookie cookie = new Cookie("test", "1234");
        response.addCookie(cookie);

        return "index";
    }
}
